﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"
    Inherits="masterdata_view_manufacturers" CodeFile="view_manufacturers.aspx.cs" %>

<%@ Register Src="~/UserControl/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>制造商维护 </title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        $(function () {
            var dlg = $('#dd').dialog({
                title: '制造商维护',
                iconCls: 'icon-ok',
                closed: true,
                buttons: [{
                    text: '保存',
                    handler: function () {
                        $get('<%=btnSave.ClientID %>').click();
                    }
                }, {
                    text: '取消',
                    handler: function () {
                        $('#dd').dialog('close');
                    }
                }]
            });
            dlg.parent().appendTo(jQuery("form:first"));
        });
        function open1() {
            $('#dd').dialog('open');
        }
        function close1() {
            $('#dd').dialog('close');
        }
    </script>
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table id="wsd_inputtable" width="100%">
                <tr>
                    <td class="tabletitle">
                        厂商维护
                    </td>
                </tr>
            </table>
            <table id="wsd_listtable" width="100%">
                <tr>
                    <td style="width: 100%">
                        <asp:GridView Width="100%" ID="GridView1" DataKeyNames="ID" runat="server" AutoGenerateColumns="False"
                            OnRowDataBound="Grid_RowDataBound" EmptyDataText="<%$ resources:language,lbl_Empty %>"
                            EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                            EnableEmptyContentRender="true" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                            AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="15"
                            EnableModelValidation="True">
                            <HeaderStyle CssClass="titlist" />
                            <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                            <Columns>
                                <asp:TemplateField HeaderText="代码" ItemStyle-Width="30%">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="Select"
                                            Text='<%# Eval("ManuCode") %>' OnClientClick="open1()"></asp:LinkButton>
                                    </ItemTemplate>
                                    <ControlStyle Font-Underline="False" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="制造商名称" ItemStyle-Width="30%">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="false" CommandName="Select"
                                            Text='<%# Eval("ManuName") %>' OnClientClick="open1();"></asp:LinkButton>
                                    </ItemTemplate>
                                    <ControlStyle Font-Underline="False" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="竞争者" ItemStyle-Width="30%" ItemStyle-HorizontalAlign="center"
                                    HeaderStyle-HorizontalAlign="center">
                                    <ItemTemplate>
                                        <b>
                                            <%# (bool)Eval("CONTENDER") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%></b>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="有效" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center">
                                    <ItemTemplate>
                                        <b>
                                            <%# (bool)Eval("ACTIVE") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%></b>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                            </Columns>
                            <RowStyle CssClass="evenline" />
                            <AlternatingRowStyle CssClass="oddline" />
                            <PagerSettings Visible="false" FirstPageText="<%$resources:language,lbl_First_Page %>"
                                LastPageText="<%$resources:language,lbl_Last_Page %>" PageButtonCount="30" />
                        </asp:GridView>
                        <uc1:GridPager ID="GridPager1" runat="server" Visible="false" />
                    </td>
                </tr>
            </table><br />
            <table id="wsd_inputtable">
                <tr>
                    <td height="10px" class="tabletitle">
                        <asp:Literal ID="Literal40" runat="server" Text="<%$resources:language,lbl_Operation_Area %>"></asp:Literal>
                    </td>
                </tr>
                <tr>
                    <td class="buttonarea" style="height: 39px">
                        <asp:Button ID="Button1" runat="server" class="wsd_button2" Text="<%$resources:language,btn_Add %>"
                            OnClick="Button1_Click" OnClientClick="open1();" CausesValidation="false" />&nbsp;&nbsp;
                    </td>
                </tr>
            </table>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <div id="dd" icon="icon-save" style="width: 350px; height: 230px; text-align: center;">
        <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel2" runat="server">
            <ContentTemplate>
           
                <table >
                    <tr>
                        <td class="tabletitle" >
                            <font color="red" size="2"><b>
                                <asp:Literal ID="Literal1" runat="server" Text="<%$resources:language,lbl_Required %>"></asp:Literal>
                            </b></font>
                            <asp:Literal ID="Literal5" runat="server" Visible="false" Text="<%$resources:language,lbl_MaintainManufacturer %>"></asp:Literal>
                            &nbsp;&nbsp;
                        </td>
                    </tr>
                </table>
               
                <table id="wsd_inputtable" style=" border:0px; ">
                    <tr>
                        <td>
                        <center>
                            <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BorderWidth="0px"
                                DataSourceID="ObjectDataSource1" DefaultMode="Insert" OnDataBound="DetailsView1_DataBound"
                                HorizontalAlign="Center" GridLines="None" EnableModelValidation="True">
                                <Fields>
                                    <asp:TemplateField HeaderText="代码<font color=red>*</font>">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtCode" class="default" runat="server" MaxLength="20" Text='<%# Bind("ManuCode") %>'></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="<%$resources:language,lbl_TheRequired %>"
                                                ControlToValidate="txtCode" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="名称<font color=red>*</font>">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtName" class="default" runat="server" Text='<%# Bind("ManuName") %> '
                                                MaxLength="20"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="<%$resources:language,lbl_TheRequired %>"
                                                ControlToValidate="txtName"  Display="Dynamic"></asp:RequiredFieldValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<%$resources:language,lbl_Active %>">
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="chkValid" Checked='<%# Bind("ACTIVE") %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<%$resources:language,lbl_Competitor %>">
                                        <ItemTemplate>
                                            <asp:CheckBox ID="cbxContender" runat="server" Checked='<%# Bind("CONTENDER") %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Fields>
                                <RowStyle CssClass="tablefield"  />
                                
                            </asp:DetailsView>
                            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Jumpton.SFA.Server.Entity.MANUFACTURERS"
                                InsertMethod="Save" SelectMethod="Load" TypeName="Jumpton.SFA.Server.BusinessRule.MasterData.ManufacturersManager"
                                UpdateMethod="Save">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="GridView1" DefaultValue="" Name="ID" PropertyName="SelectedValue"
                                        Type="Int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                            </center>
                        </td>
                    </tr>
                </table>
                <div style="display: none;">
                    <table style="width: 200px;">
                        <tr>
                            <td class="buttonarea" style="height: 39px;">
                                <asp:Button ID="btnSave" runat="server" class="wsd_button2" Text="<%$resources:language,btn_Save %>"
                                    OnClick="btnSave_Click" />&nbsp;&nbsp;
                            </td>
                        </tr>
                    </table>
                </div>
               
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
